﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
using Aij1.Model;
using DevExpress.Data.Filtering;

namespace Aij1.BLL
{
    public class MenuData
    {
        public static XPCollection<P_MgrMenu> GetMenus(Session session)
        {
            var menus = new XPCollection<P_MgrMenu>(session);
            menus.Sorting.Add(new SortProperty("OrderId", DevExpress.Xpo.DB.SortingDirection.Ascending));
            menus.Sorting.Add(new SortProperty("Oid", DevExpress.Xpo.DB.SortingDirection.Ascending));
            return menus;
        }

        public static XPCollection<P_ClientMenu> GetClientMenus(Session session, MenuPositionType pos)
        {
            var menus = new XPCollection<P_ClientMenu>(session, CriteriaOperator.Parse("Pos=?", pos));
            menus.Sorting.Add(new SortProperty("OrderId", DevExpress.Xpo.DB.SortingDirection.Ascending));
            menus.Sorting.Add(new SortProperty("Oid", DevExpress.Xpo.DB.SortingDirection.Ascending));
            return menus;
        }
    }
}
